import 'package:flutter/material.dart';

import 'horizontal_list_home_widget.dart';

class HorizontalListCommonlyWidget extends StatefulWidget {
  final Color background;
  final String title;
  final List<String> text;
  final List<String> route;
  final List<String> image;
  final double height;
  HorizontalListCommonlyWidget(
      {this.background,
      @required this.title,
      this.route,
      this.image,
      this.text,
      this.height});

  @override
  State<StatefulWidget> createState() {
    return HorizontalListCommonlyWidgetState();
  }
}

class HorizontalListCommonlyWidgetState extends State<HorizontalListCommonlyWidget> {
   String modularString;
  @override
  void initState() {
     if(widget.title=="常用作业功能"){
       modularString="作业";
     }else if(widget.title=="常用信息功能"){
       modularString="信息";
     }
  }

  @override
  Widget build(BuildContext context) {
    return Padding(
        padding: EdgeInsets.only(top: 10),
        child: Container(
          height: widget.height,
          width: double.infinity,
          color: Colors.white,
          child: Column(
            children: <Widget>[
              Padding(
                  padding: EdgeInsets.all(15),
                  child: Row(
                    children: <Widget>[
                      Container(
                        width: 1,
                        height: 15,
                        decoration: BoxDecoration(
                            border:
                                Border.all(color: Color(0xFFF87337), width: 1)),
                      ),
                      Padding(
                          padding: EdgeInsets.only(left: 5),
                          child: Text(
                            widget.title,
                            style: TextStyle(fontSize: 15),
                          ))
                    ],
                  )),
              Divider(height: 1, color: Color(0xffdddddd)),
              Expanded(
                  child: Padding(
                padding: EdgeInsets.all(0),
                child: Row(
                  children: <Widget>[
                    Expanded(
                        child: HorizontalListHomeWidget(
                          modular: modularString,
                          imageHeight: 40,imageWidth: 40,
                      fontSize: 14,
                      fontColor: Colors.black,
                      title: widget.text[0],
                      image: widget.image[0],
                      route: widget.route[0],
                    )),
                    Expanded(
                        child: HorizontalListHomeWidget(
                          modular: modularString,
                          imageHeight: 40,imageWidth: 40,
                          fontSize: 14,
                          fontColor: Colors.black,
                          title: widget.text[1],
                          image: widget.image[1],
                          route: widget.route[1],
                        )),
                    Expanded(
                        child: HorizontalListHomeWidget(
                          modular: modularString,
                          imageHeight: 40,imageWidth: 40,
                          fontSize: 14,
                          fontColor: Colors.black,
                          title: widget.text[2],
                          image: widget.image[2],
                          route: widget.route[2],
                        )),
                    Expanded(
                        child: HorizontalListHomeWidget(
                          modular: modularString,
                          imageHeight: 40,imageWidth: 40,
                          fontSize: 14,
                          fontColor: Colors.black,
                          title: widget.text[3],
                          image: widget.image[3],
                          route: widget.route[3],
                        )),
                  ],
                ),
              ))
            ],
          ),
        ));
  }


}
